const express = require('express');
const router = express.Router();
router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 20; i++)
        content.push({
            id: `2019${i}`,
            code: `2019${i}`,
            brandCode: `00${i}`,
            brandName: `品牌${i}`,
            branchCode: '20119',
            type: 0,
            vin: 'string',
            productCategoryCode: 'string',
            currency: 0,
            totalFee: 0,
            status: 0,
            settlementStatus: 0,
            rowVersion: 'string',
            options: ['update', 'abandon', 'opeation', 'submit']
        });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 20,
        }
    });
});

router.get('/:id', (req, res) => {
    res.json(
        {
            message: 'string',
            payload: {
                id: '20191',
                code: '20191',
                brandCode: 'string',
                brandName: 'string',
                dealerCode: 'string',
                type: 0,
                vin: 'string',
                productCategoryCode: 'string',
                currency: 0,
                totalFee: 0,
                status: 0,
                settlementStatus: 0,
                rowVersion: 'string',
                options: ['update', 'abandon', 'opeation', 'submit'],
                brandId: 'string',
                country: 'string',
                engineCode: 'string',
                transmissionSn: 'string',
                salesDate: '2020-05-06T06:26:54.267Z',
                mileage: 0,
                tel: 'string',
                faultDescription: 'string',
                faultDescriptionTrans: 'string',
                opinion: 'string',
                opinionTrans: 'string',
                laborFee: 0,
                materialFee: 0,
                details: [
                    {
                        id: '${i}',
                        type: 1,
                        code: 'string',
                        name: 'string',
                        usedQty: 0,
                        price: 0,
                        totalPrice: 0
                    }
                ],
                approveResults: [
                    {
                        approverName: 'string',
                        approvedResult: 0,
                        approveComment: 'string',
                        approveTime: '2020-05-06T06:26:54.267Z'
                    }
                ],
            }
        }
    );
});

router.put('/:id', (req, res) => {
    res.json(
        {
            message: '修改成功'
        }
    );
});

router.post('/', (req, res) => {
    res.json(
        {
            message: '新增成功'
        }
    );
});

router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});
router.put('/:id/submit', (req, res) => {
    res.json({
        message: '提交成功'
    });
});
router.put('/:id/opeation', (req, res) => {
    res.json({
        message: '确认成功'
    });
});
router.get('/forGoodwillSettlement', (req, res) => {
    const content = [];
    for(let i = 0; i < 20; i++)
        content.push({
            id: `2019${i}`,
            goodWillCode: `goodWillCode2019${i}`,
            laborFee: 13521.21,
            materialFee: 1321.21,
            totalFee: 546451.12,
            dealerCode: `dealerCode${i}`,
            dealerName: `dealerName${i}`,
            brandCode: `brandCode${i}`,
            brandName: `brandName${i}`,
            vin: 'vin',
            settlementStatus: 1,
            status: 1,
            goodWillDetails: [
                {
                    id: '${i}',
                    type: 1,
                    code: 'code001',
                    name: 'name001',
                    usedQty: 12312,
                    price: 213.32,
                    materialFee: 21312.21
                }
            ],
            rowVersion: 'string',
            options: ['update', 'abandon', 'send', 'exportPi', 'upload', 'confirm', 'exportCover']
        });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 20,
        }
    });
});

module.exports = router;
